package com.practice.acMath003;

public class MathCommon {
    public static void main(String[] args) {
        //常量
        System.out.println(Math.E);
        System.out.println(Math.PI);
        //向上取数值
        System.out.println((int) Math.ceil(3.14));
        //向下取数值
        System.out.println(Math.floor(3.14));
        // 四舍五入
        System.out.println(Math.round(3.4));
        System.out.println(Math.round(3.5));
        System.out.println(Math.round(3.6));
        System.out.println(Math.round(3.4F));
        System.out.println(Math.round(3.5F));
        System.out.println(Math.round(3.6F));
        //生成一个 （0，1）之间的小数
        System.out.println(Math.random());
        // 取绝对值
        System.out.println(Math.abs(3));
        System.out.println(Math.abs(3L));
        System.out.println(Math.abs(3.14F));
        System.out.println(Math.abs(3.14));
        // 两个数值比较大小，返回较大的数值
        System.out.println(Math.max(1, 2));
        System.out.println(Math.max(1L, 2L));
        System.out.println(Math.max(3.14F, 3.15F));
        System.out.println(Math.max(3.14, 3.15));
        // 两个数值比较大小，返回较小数值
        System.out.println(Math.min(1, 2));
        System.out.println(Math.min(1L, 2L));
        System.out.println(Math.min(3.14F, 3.15F));
        System.out.println(Math.min(3.14, 3.15));
        System.out.println(Math.ulp(3.14));
    }
}
